package com.jooink.experiments.elementalgetusermedia.client;

import com.google.gwt.user.client.ui.Widget;

import elemental.client.Browser;
import elemental.html.CanvasElement;
import elemental.html.CanvasRenderingContext2D;


//a trivial widget wrapper around a CanvasElement 

public class ElementalCanvasWidget extends Widget {

	
	private CanvasElement canvasElement;
	
	
	public ElementalCanvasWidget() {
		canvasElement =  Browser.getDocument().createCanvasElement(); 
		setElement(ElementalUtils.castElementToElement(canvasElement));
		
	}

	public CanvasRenderingContext2D getContexd2D() {
		return (CanvasRenderingContext2D) canvasElement.getContext("2d");
	}

	public CanvasElement getCanvasElement() {
		return canvasElement;
	}
	
}
